package net.crashtoot.picasa.core.model;

import java.io.Serializable;

import com.google.gdata.data.MediaContent;
import com.google.gdata.data.photos.PhotoEntry;
import com.google.gdata.util.ServiceException;

public class Photo implements Serializable {

	private static final long serialVersionUID = 1L;

	private String id;
	private String name;
	private String comment;
	private String uri;
	private Long height;
	private Long width;
	private Long size;
	private long date;
	private String thumbnailUrl1;
	private String thumbnailUrl2;
	private String thumbnailUrl3;

	public Photo() {
	}

	public Photo(final PhotoEntry photo) {
		id = photo.getGphotoId();
		comment = photo.getSummary().getPlainText();
		name = photo.getTitle().getPlainText();
		uri = ((MediaContent) photo.getContent()).getUri();
		try {
			height = photo.getHeight();
			width = photo.getWidth();
			size = photo.getSize();
		} catch (final ServiceException e) {
		}
		if (photo.getPublished() != null) {
			this.date = photo.getPublished().getValue();
		}
		this.thumbnailUrl1 = photo.getMediaThumbnails().get(0).getUrl();
		this.thumbnailUrl2 = photo.getMediaThumbnails().get(1).getUrl();
		this.thumbnailUrl3 = photo.getMediaThumbnails().get(2).getUrl();
	}

	public String getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public String getComment() {
		return comment;
	}

	public String getUri() {
		return uri;
	}

	public Long getHeight() {
		return height;
	}

	public Long getWidth() {
		return width;
	}

	public Long getSize() {
		return size;
	}

	public long getDate() {
		return date;
	}

	public String getThumbnailUrl1() {
		return thumbnailUrl1;
	}

	public String getThumbnailUrl2() {
		return thumbnailUrl2;
	}

	public String getThumbnailUrl3() {
		return thumbnailUrl3;
	}
}
